//
//  NYBlackListViewController.m
//  Nooryes
//
//  Created by bakenPro on 5/12/20.
//  Copyright © 2020 MyApp. All rights reserved.
//

#import "NYBlackListViewController.h"
#import "NYMessageTableViewCell.h"
#import "NYMessageListModel.h"

@interface NYBlackListViewController ()

@property (weak, nonatomic) IBOutlet UITableView *tableview;

@property (strong, nonatomic) NSMutableArray *userArray;
@end

@implementation NYBlackListViewController

-(NSMutableArray *)userArray {
    if (!_userArray) {
        _userArray = [NSMutableArray array];
    }
    return _userArray;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"黑名单";
    self.tableview.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
    NSMutableArray *array = [[NSUserDefaults standardUserDefaults] mutableArrayValueForKey:@"blacklist"];
    [self.userArray addObjectsFromArray:array];
    [self.tableview reloadData];
    
    
}

#pragma mark UITableView
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSDictionary *dict = [self.userArray objectAtIndex:indexPath.row];
    MessageListModel *model = [MessageListModel new];
    model.title = dict[@"name"];
    model.image = dict[@"avatar"];
    model.content = dict[@"no"];
    NYMessageTableViewCell *cell = [NYMessageTableViewCell cellWithTableView:tableView];
    cell.model = model;
    return cell;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.userArray.count;
}
@end
